{include file='account/header.tpl'}
{include file='account/leftcol.tpl'}
<div id="left-area">
<div class="entry post clearfix width-for-all-img">
          <div class="breadcrumb">
            <span class="raquo"></span><a href="/">Главная</a>
           <span class="raquo"> &raquo; </span><a href="{geturl controller="account"}">Мой профиль</a>  
           <span class="raquo"> &raquo; </span><a href="{geturl controller='account' action='active'}">Мои покупки</a>  
    </div>
    <h1 class="category-title">Мои покупки</h1>
    <div class="product-filter">
       
        <div class="sort">Сортировка:      <select onchange="location = this.value;">
                <option value="?sort=date&amp;order=DESC{if $type}&type={$type}{/if}" {if $sort=='date' && $order=='DESC'}selected="selected"{/if}>По умолчанию</option>
                <option value="?sort=shopId&amp;order=ASC{if $type}&type={$type}{/if}" {if $sort=='shopId' && $order=='ASC'}selected="selected"{/if}>Магазин (по возрастанию)</option>
                <option value="?sort=shopId&amp;order=DESC{if $type}&type={$type}{/if}" {if $sort=='shopId' && $order=='DESC'}selected="selected"{/if}>Магазин (по убыванию)</option>
                <option value="?sort=date&amp;order=ASC{if $type}&type={$type}{/if}" {if $sort=='date' && $order=='ASC'}selected="selected"{/if}>Дата добавления (по возрастанию)</option>
                <option value="?sort=date&amp;order=DESC{if $type}&type={$type}{/if}" {if $sort=='date' && $order=='DESC'}selected="selected"{/if}>Дата добавления (по убыванию)</option>
            </select>
        </div>
         <div class="type">На странице:      <select onchange="location = this.value;">
                <option value="{geturl action="active"}" >Все покупки</option>
                <option value="?type=active" {if $type=='active'}selected{/if}>Активные</option>
                <option value="?type=finished" {if $type=='finished'}selected{/if}>Завершеные</option>
                <option value="?type=deviation" {if $type=='deviation'}selected{/if}>Отклоненые</option>
            
            </select>
        </div>
    
    </div>
    <table class="tdzayavki" width="100%">
        <thead>
            <tr> 
               
                <td>
                    {if $sort=='shopId'}
                    <a href="?sort=shopId&order={if $order=='desc'}asc{else}desc{/if}{if $type}&type={$type}{/if}" class="{$order}">Магазин</a>
                    {else}
                    <a href="?sort=shopId&order={if $order=='desc'}asc{else}desc{/if}{if $type}&type={$type}{/if}">Магазин</a>
                    {/if}
                </td>
                
                  <td>
                    {if $sort=='date'}
                    <a href="?sort=date&order={if $order=='desc'}asc{else}desc{/if}{if $type}&type={$type}{/if}" class="{$order}">Дата</a>
                    {else}
                    <a href="?sort=date&order={if $order=='desc'}asc{else}desc{/if}{if $type}&type={$type}{/if}">Дата</a>
                    {/if}
                </td>
                  <td>
                    {if $sort=='shopId'}
                    <a href="?sort=status&order={if $order=='desc'}asc{else}desc{/if}{if $type}&type={$type}{/if}" class="{$order}">Статус</a>
                    {else}
                    <a href="?sort=status&order={if $order=='desc'}asc{else}desc{/if}{if $type}&type={$type}{/if}">Статус</a>
                    {/if}
                </td>
              
                <td class="tb5">Действие</td>
            </tr>
        </thead>

       {foreach from=$categories item=d}
        <tr id="tr_{$d->getId()}">
            
            <td>
                {$d->shop->nameshop}
            </td>
            <td>
                {$d->date|date_format:"%d %b %Y %H:%M:%S"}
            </td>
            <td>
                {$d->status}
            </td>
            <td>
                 <a href="{geturl route='zakazview' id=$d->getId()}"><img src="/images/smotret.png" alt="Подробнее"></a>
             
                <a onclick="deletezakaz({$d->getId()})" style="cursor: pointer"><img src="/images/index-07.png" alt="Удалить"></a>
                

            </td>

        </tr>
        {/foreach} 
    </table> 
    <br><br>

{if $pages->count_pages > 1}
<div class="wp-pagenavi">
<span class="pages">Страница {$p} из {$pages->count_pages}</span> 
<!-- Previous page link -->
 <a href="{geturl controller="account" action="active"}{if $type}?type={$type}{if $cat}&cat={$cat}{/if}{else}{if $cat}?cat={$cat}{/if}{/if}" class="last">«Первая</a> 
{if $pages->active > '1' }
<a href="{geturl controller="account" action="active"}?p={$pages->active-1}{if $cat}&cat={$cat}{/if}{if $type}&type={$type}{/if}" >«</a> 
{/if}
<!-- Numbered page links -->
{section name=foo start=$pages->start loop=$pages->end step=1}

{if $smarty.section.foo.index != $pages->active }
<a href="{geturl controller="account" action="active"}?p={$smarty.section.foo.index}{if $cat}&cat={$cat}{/if}{if $type}&type={$type}{/if}" class="page smaller">{$smarty.section.foo.index}</a> 
{else}
 <span class="current">{$smarty.section.foo.index}</span>
{/if}
{/section}
<!-- Next page link -->
{if $pages->active < $pages->count_pages}
<a href="{geturl controller="account" action="active"}?p={$pages->active+1}{if $cat}&cat={$cat}{/if}{if $type}&type={$type}{/if}" class="nextpostslink">»</a>
 {/if}
 <a href="{geturl controller="account" action="active"}?p={$pages->count_pages}{if $cat}&cat={$cat}{/if}{if $type}&type={$type}{/if}" class="last">Последняя»</a> 
 </div>
 {/if}
<div class="botline"></div>


</div>
{include file="footer.tpl"}

